﻿/* 
This file is part of Ingo Karstein's Web based PowerShell Console project

**Do not remove this comment**

Please see the project homepage at CodePlex:
  http://webpsconsole.codeplex.com/

Please see my blog:
  http://ikarstein.wordpress.com

Licence: GPLv2
    Ingo Karstein's SharePoint 2010 Custom Ribbon Demo
    Copyright (C) 2011  Ingo Karstein, ikarstein@hotmail.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using System.Management.Automation;
using System.ComponentModel;

namespace ik.PowerShell.WebPSConsole
{
    [System.Management.Automation.Cmdlet("Out", "WebPSConsole")]
    public class OutWebPSConsoleCmdlet:System.Management.Automation.PSCmdlet, IRequiresSessionState
    {
        [System.Management.Automation.Parameter(Position=0, Mandatory=true, ValueFromPipeline=true)]
        public PSObject InputString;

        protected override void BeginProcessing()
        {
            base.BeginProcessing();
        }

        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            if( Statics.Server != null )
            {
                //Globals.Server.WriteFromPSEnvironment((string)InputString);
                WriteObject(InputString);
            }
        }

        protected override void EndProcessing()
        {
            base.EndProcessing();
        }
    }
}